< previous page page_279 next page >

Page 279
0279-01.jpg
Figure 8.7.
The results of a complex 
WHERE clause.
You can use several AND and OR operators to link valid logical comparisons together to form a single WHERE clause. You can also use more than just =, <>, >, <, <=, and >= logical comparisons. Visual Basic SQL supports the use of BETWEEN_AND, IN, and LIKE comparisons. The following SQL statement illustrates the use of BETWEEN_AND in a WHERE clause. Check your results against those shown in Figure 8.8.
SELECT PubID, Name, StateProv, City FROM Publishers
   WHERE PubID BETWEEN 10 AND 15
0279-02.jpg
Figure 8.8.
Using 
BETWEEN_AND in a WHERE clause.
The result set contains only rows that have a PubID value between 10 and 15. Notice that the values listed in the BETWEEN_AND clause (10 and 15) are included in the result set.
You can also use SQL to return a result set that contains rows that match a set of noncontiguous data. For example, if you wanted a list of all the publishers in the states of

 
< previous page page_279 next page >

If you like this book, buy it!